// Generated with smithy-dart 0.3.1. DO NOT MODIFY.
// ignore_for_file: avoid_unused_constructor_parameters,deprecated_member_use_from_same_package,non_constant_identifier_names,require_trailing_commas

library amplify_storage_s3_dart.s3.model.put_object_output; // ignore_for_file: no_leading_underscores_for_library_prefixes

import 'package:amplify_storage_s3_dart/src/sdk/src/s3/model/request_charged.dart';
import 'package:amplify_storage_s3_dart/src/sdk/src/s3/model/server_side_encryption.dart';
import 'package:aws_common/aws_common.dart' as _i1;
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';
import 'package:meta/meta.dart' as _i3;
import 'package:smithy/smithy.dart' as _i2;

part 'put_object_output.g.dart';

abstract class PutObjectOutput
    with _i1.AWSEquatable<PutObjectOutput>
    implements
        Built<PutObjectOutput, PutObjectOutputBuilder>,
        _i2.EmptyPayload,
        _i2.HasPayload<PutObjectOutputPayload> {
  factory PutObjectOutput({
    String? expiration,
    String? eTag,
    String? checksumCrc32,
    String? checksumCrc32C,
    String? checksumSha1,
    String? checksumSha256,
    ServerSideEncryption? serverSideEncryption,
    String? versionId,
    String? sseCustomerAlgorithm,
    String? sseCustomerKeyMd5,
    String? ssekmsKeyId,
    String? ssekmsEncryptionContext,
    bool? bucketKeyEnabled,
    RequestCharged? requestCharged,
  }) {
    return _$PutObjectOutput._(
      expiration: expiration,
      eTag: eTag,
      checksumCrc32: checksumCrc32,
      checksumCrc32C: checksumCrc32C,
      checksumSha1: checksumSha1,
      checksumSha256: checksumSha256,
      serverSideEncryption: serverSideEncryption,
      versionId: versionId,
      sseCustomerAlgorithm: sseCustomerAlgorithm,
      sseCustomerKeyMd5: sseCustomerKeyMd5,
      ssekmsKeyId: ssekmsKeyId,
      ssekmsEncryptionContext: ssekmsEncryptionContext,
      bucketKeyEnabled: bucketKeyEnabled,
      requestCharged: requestCharged,
    );
  }

  factory PutObjectOutput.build([
    void Function(PutObjectOutputBuilder) updates,
  ]) = _$PutObjectOutput;

  const PutObjectOutput._();

  /// Constructs a [PutObjectOutput] from a [payload] and [response].
  factory PutObjectOutput.fromResponse(
    PutObjectOutputPayload payload,
    _i1.AWSBaseHttpResponse response,
  ) => PutObjectOutput.build((b) {
    if (response.headers['x-amz-expiration'] != null) {
      b.expiration = response.headers['x-amz-expiration']!;
    }
    if (response.headers['ETag'] != null) {
      b.eTag = response.headers['ETag']!;
    }
    if (response.headers['x-amz-checksum-crc32'] != null) {
      b.checksumCrc32 = response.headers['x-amz-checksum-crc32']!;
    }
    if (response.headers['x-amz-checksum-crc32c'] != null) {
      b.checksumCrc32C = response.headers['x-amz-checksum-crc32c']!;
    }
    if (response.headers['x-amz-checksum-sha1'] != null) {
      b.checksumSha1 = response.headers['x-amz-checksum-sha1']!;
    }
    if (response.headers['x-amz-checksum-sha256'] != null) {
      b.checksumSha256 = response.headers['x-amz-checksum-sha256']!;
    }
    if (response.headers['x-amz-server-side-encryption'] != null) {
      b.serverSideEncryption = ServerSideEncryption.values.byValue(
        response.headers['x-amz-server-side-encryption']!,
      );
    }
    if (response.headers['x-amz-version-id'] != null) {
      b.versionId = response.headers['x-amz-version-id']!;
    }
    if (response.headers['x-amz-server-side-encryption-customer-algorithm'] !=
        null) {
      b.sseCustomerAlgorithm =
          response.headers['x-amz-server-side-encryption-customer-algorithm']!;
    }
    if (response.headers['x-amz-server-side-encryption-customer-key-MD5'] !=
        null) {
      b.sseCustomerKeyMd5 =
          response.headers['x-amz-server-side-encryption-customer-key-MD5']!;
    }
    if (response.headers['x-amz-server-side-encryption-aws-kms-key-id'] !=
        null) {
      b.ssekmsKeyId =
          response.headers['x-amz-server-side-encryption-aws-kms-key-id']!;
    }
    if (response.headers['x-amz-server-side-encryption-context'] != null) {
      b.ssekmsEncryptionContext =
          response.headers['x-amz-server-side-encryption-context']!;
    }
    if (response.headers['x-amz-server-side-encryption-bucket-key-enabled'] !=
        null) {
      b.bucketKeyEnabled =
          response
              .headers['x-amz-server-side-encryption-bucket-key-enabled']! ==
          'true';
    }
    if (response.headers['x-amz-request-charged'] != null) {
      b.requestCharged = RequestCharged.values.byValue(
        response.headers['x-amz-request-charged']!,
      );
    }
  });

  static const List<_i2.SmithySerializer<PutObjectOutputPayload>> serializers =
      [PutObjectOutputRestXmlSerializer()];

  /// If the expiration is configured for the object (see [PutBucketLifecycleConfiguration](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketLifecycleConfiguration.html)) in the _Amazon S3 User Guide_, the response includes this header. It includes the `expiry-date` and `rule-id` key-value pairs that provide information about object expiration. The value of the `rule-id` is URL-encoded.
  ///
  /// This functionality is not supported for directory buckets.
  String? get expiration;

  /// Entity tag for the uploaded object.
  ///
  /// **General purpose buckets** \- To ensure that data is not corrupted traversing the network, for objects where the ETag is the MD5 digest of the object, you can calculate the MD5 while putting an object to Amazon S3 and compare the returned ETag to the calculated MD5 value.
  ///
  /// **Directory buckets** \- The ETag for the object in a directory bucket isn't the MD5 digest of the object.
  String? get eTag;

  /// The base64-encoded, 32-bit CRC32 checksum of the object. This will only be present if it was uploaded with the object. When you use an API operation on an object that was uploaded using multipart uploads, this value may not be a direct checksum value of the full object. Instead, it's a calculation based on the checksum values of each individual part. For more information about how checksums are calculated with multipart uploads, see [Checking object integrity](https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) in the _Amazon S3 User Guide_.
  String? get checksumCrc32;

  /// The base64-encoded, 32-bit CRC32C checksum of the object. This will only be present if it was uploaded with the object. When you use an API operation on an object that was uploaded using multipart uploads, this value may not be a direct checksum value of the full object. Instead, it's a calculation based on the checksum values of each individual part. For more information about how checksums are calculated with multipart uploads, see [Checking object integrity](https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) in the _Amazon S3 User Guide_.
  String? get checksumCrc32C;

  /// The base64-encoded, 160-bit SHA-1 digest of the object. This will only be present if it was uploaded with the object. When you use the API operation on an object that was uploaded using multipart uploads, this value may not be a direct checksum value of the full object. Instead, it's a calculation based on the checksum values of each individual part. For more information about how checksums are calculated with multipart uploads, see [Checking object integrity](https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) in the _Amazon S3 User Guide_.
  String? get checksumSha1;

  /// The base64-encoded, 256-bit SHA-256 digest of the object. This will only be present if it was uploaded with the object. When you use an API operation on an object that was uploaded using multipart uploads, this value may not be a direct checksum value of the full object. Instead, it's a calculation based on the checksum values of each individual part. For more information about how checksums are calculated with multipart uploads, see [Checking object integrity](https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) in the _Amazon S3 User Guide_.
  String? get checksumSha256;

  /// The server-side encryption algorithm used when you store this object in Amazon S3 (for example, `AES256`, `aws:kms`, `aws:kms:dsse`).
  ///
  /// For directory buckets, only server-side encryption with Amazon S3 managed keys (SSE-S3) (`AES256`) is supported.
  ServerSideEncryption? get serverSideEncryption;

  /// Version ID of the object.
  ///
  /// If you enable versioning for a bucket, Amazon S3 automatically generates a unique version ID for the object being stored. Amazon S3 returns this ID in the response. When you enable versioning for a bucket, if Amazon S3 receives multiple write requests for the same object simultaneously, it stores all of the objects. For more information about versioning, see [Adding Objects to Versioning-Enabled Buckets](https://docs.aws.amazon.com/AmazonS3/latest/dev/AddingObjectstoVersioningEnabledBuckets.html) in the _Amazon S3 User Guide_. For information about returning the versioning state of a bucket, see [GetBucketVersioning](https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketVersioning.html).
  ///
  /// This functionality is not supported for directory buckets.
  String? get versionId;

  /// If server-side encryption with a customer-provided encryption key was requested, the response will include this header to confirm the encryption algorithm that's used.
  ///
  /// This functionality is not supported for directory buckets.
  String? get sseCustomerAlgorithm;

  /// If server-side encryption with a customer-provided encryption key was requested, the response will include this header to provide the round-trip message integrity verification of the customer-provided encryption key.
  ///
  /// This functionality is not supported for directory buckets.
  String? get sseCustomerKeyMd5;

  /// If `x-amz-server-side-encryption` has a valid value of `aws:kms` or `aws:kms:dsse`, this header indicates the ID of the Key Management Service (KMS) symmetric encryption customer managed key that was used for the object.
  ///
  /// This functionality is not supported for directory buckets.
  String? get ssekmsKeyId;

  /// If present, indicates the Amazon Web Services KMS Encryption Context to use for object encryption. The value of this header is a base64-encoded UTF-8 string holding JSON with the encryption context key-value pairs. This value is stored as object metadata and automatically gets passed on to Amazon Web Services KMS for future `GetObject` or `CopyObject` operations on this object.
  ///
  /// This functionality is not supported for directory buckets.
  String? get ssekmsEncryptionContext;

  /// Indicates whether the uploaded object uses an S3 Bucket Key for server-side encryption with Key Management Service (KMS) keys (SSE-KMS).
  ///
  /// This functionality is not supported for directory buckets.
  bool? get bucketKeyEnabled;

  /// If present, indicates that the requester was successfully charged for the request.
  ///
  /// This functionality is not supported for directory buckets.
  RequestCharged? get requestCharged;
  @override
  PutObjectOutputPayload getPayload() => PutObjectOutputPayload();

  @override
  List<Object?> get props => [
    expiration,
    eTag,
    checksumCrc32,
    checksumCrc32C,
    checksumSha1,
    checksumSha256,
    serverSideEncryption,
    versionId,
    sseCustomerAlgorithm,
    sseCustomerKeyMd5,
    ssekmsKeyId,
    ssekmsEncryptionContext,
    bucketKeyEnabled,
    requestCharged,
  ];

  @override
  String toString() {
    final helper = newBuiltValueToStringHelper('PutObjectOutput')
      ..add('expiration', expiration)
      ..add('eTag', eTag)
      ..add('checksumCrc32', checksumCrc32)
      ..add('checksumCrc32C', checksumCrc32C)
      ..add('checksumSha1', checksumSha1)
      ..add('checksumSha256', checksumSha256)
      ..add('serverSideEncryption', serverSideEncryption)
      ..add('versionId', versionId)
      ..add('sseCustomerAlgorithm', sseCustomerAlgorithm)
      ..add('sseCustomerKeyMd5', sseCustomerKeyMd5)
      ..add('ssekmsKeyId', '***SENSITIVE***')
      ..add('ssekmsEncryptionContext', '***SENSITIVE***')
      ..add('bucketKeyEnabled', bucketKeyEnabled)
      ..add('requestCharged', requestCharged);
    return helper.toString();
  }
}

@_i3.internal
abstract class PutObjectOutputPayload
    with _i1.AWSEquatable<PutObjectOutputPayload>
    implements
        Built<PutObjectOutputPayload, PutObjectOutputPayloadBuilder>,
        _i2.EmptyPayload {
  factory PutObjectOutputPayload([
    void Function(PutObjectOutputPayloadBuilder) updates,
  ]) = _$PutObjectOutputPayload;

  const PutObjectOutputPayload._();

  @override
  List<Object?> get props => [];

  @override
  String toString() {
    final helper = newBuiltValueToStringHelper('PutObjectOutputPayload');
    return helper.toString();
  }
}

class PutObjectOutputRestXmlSerializer
    extends _i2.StructuredSmithySerializer<PutObjectOutputPayload> {
  const PutObjectOutputRestXmlSerializer() : super('PutObjectOutput');

  @override
  Iterable<Type> get types => const [
    PutObjectOutput,
    _$PutObjectOutput,
    PutObjectOutputPayload,
    _$PutObjectOutputPayload,
  ];

  @override
  Iterable<_i2.ShapeId> get supportedProtocols => const [
    _i2.ShapeId(namespace: 'aws.protocols', shape: 'restXml'),
  ];

  @override
  PutObjectOutputPayload deserialize(
    Serializers serializers,
    Iterable<Object?> serialized, {
    FullType specifiedType = FullType.unspecified,
  }) {
    return PutObjectOutputPayloadBuilder().build();
  }

  @override
  Iterable<Object?> serialize(
    Serializers serializers,
    PutObjectOutputPayload object, {
    FullType specifiedType = FullType.unspecified,
  }) {
    final result$ = <Object?>[
      const _i2.XmlElementName(
        'PutObjectOutput',
        _i2.XmlNamespace('http://s3.amazonaws.com/doc/2006-03-01/'),
      ),
    ];

    return result$;
  }
}
